# -*- coding: utf-8 -*-
# Author: xiantingDeng
# File: 06_匿名函数.py
# Time: 21:15


# infors = [21,345,346,456,5,756,7,56,756]
# infors.sort(reverse=True) # True 进行正序
# print(infors)

# infors.reverse() # 进行倒序
# print(infors)
'''
infors = [{"name":"laowang","age":32},{"name":"xiaoming","age":22},{"name":"laozhao","age":50}]

# 对包含字典的数据进行排序
infors.sort(key=lambda x:x["age"])
print(infors)
'''

# 匿名函数当做参数传输
'''
def test(a,b,func):
    result = func(a,b)
    return result

num = test(11,22,lambda x,y:x+y)

print(num)
'''

# 匿名函数

def test(a,b,func):
    result =func(a,b)
    return result

func_new = eval(input("请输入一个人匿名函数:")) # 输入的是字符串，不能进行调用，只能通过eval转换
# eval相当于把双引号删除
print(test(11,22,func_new))

print(eval("1+2"))
